package kz.alamty.dev.obj;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * Answer entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "answer", catalog = "dbtest")
public class Answer implements java.io.Serializable {
	/** 
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer id;
	private Question question;
	private User user;
	private String choose;

	/** default constructor */
	public Answer() {
	}

	/** full constructor */
	public Answer(Question question, User user, String choose) {
		this.question = question;
		this.user = user;
		this.choose = choose;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "questionid")
	public Question getQuestion() {
		return this.question;
		
	}

	public void setQuestion(Question question) {
		this.question = question;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "choose", length = 1)
	public String getChoose() {
		return this.choose;
	}

	public void setChoose(String choose) {
		this.choose = choose;
	}

}